from django.contrib.gis.db import models


class WorldBorder(models.Model):
    """世界边境模型"""
    name = models.CharField(max_length=50, verbose_name='名称')  # 名称
    area = models.IntegerField(verbose_name='地区')  # 地区
    pop2005 = models.IntegerField(verbose_name='人口 2005')  # 人口2005
    fips = models.CharField(max_length=2, null=True, verbose_name='FIPS Code')  # fips代码
    iso2 = models.CharField(max_length=2, verbose_name='2 Digit ISO')  # 2位iso代码
    iso3 = models.CharField(max_length=3, verbose_name='3 Digit ISO')  # 3位iso代码
    un = models.IntegerField(verbose_name='United Nations Code')  # 联合国代码
    region = models.IntegerField(verbose_name='Region Code')  # 地区代码
    subregion = models.IntegerField(verbose_name='Sub-Region Code')  # 子地区代码
    lon = models.FloatField()  # 经度
    lat = models.FloatField()  # 纬度
    mpoly = models.MultiPolygonField()  # 几何信息, MultiPolygonField: 多边形字段

    def __str__(self):
        return self.name

    class Meta:
        ordering = ('name', )
